home *** CD-ROM | disk | FTP | other *** search
/ Apple Reference & Presen…tion Library 2 (Reseller) / Apple R&P Lib Reseller v2.0.iso / 4-Fonts & Software / Demo Software / AppMaker / Demo AppMaker™ / Demo AppMaker™.rsrc / TmpP_210_ModelessDialog.txt < prev    next >
Encoding:
Text File  |  1989-04-09  |  2.5 KB  |  134 lines

  1. # (decoded with TMPL 11972)
  2. { %filename% -- modeless dialog }
  3. { Created %date% %time% by AppMaker }
  4.  
  5. Unit %unitname%;
  6. Interface
  7.  
  8. Uses
  9. %If MPW%
  10.     {$Load ToolBox.dump}
  11.         MemTypes,
  12.         QuickDraw,
  13.         OSIntf,
  14.         ToolIntf,
  15.         PackIntf,
  16.     {$Load}
  17.  
  18. %end if%
  19. %If Think%
  20. {$ifc undefined Think_Pascal}
  21.     ListManager,
  22. {$endc}
  23. %end if%
  24.     ResourceDefs,
  25.     DialogAids;
  26.  
  27. Type
  28.     %dlogname%Rec        = record
  29.         %DeclItems%
  30.     end;
  31.     %dlogname%Ptr        = ^%dlogname%Rec;
  32.     %dlogname%Handle    = ^%dlogname%Ptr;
  33.     
  34. Var
  35.     %dlogname%Dialog:    DialogPtr;
  36.  
  37. {----------}
  38. Procedure Init%dlogname%;
  39. Procedure Do%dlogname%;
  40. Procedure Close%dlogname%;
  41. Function  Filter%dlogname%    (whichDialog:    DialogPtr;
  42.                      var event:            EventRecord;
  43.                      var itemHit:        integer): boolean;
  44. Procedure Do%dlogname%Item (itemNr:        integer);
  45.  
  46. {----------}
  47. Implementation
  48.  
  49. %If MPW%
  50. {$D+}
  51. {$R+}
  52. {$OV+}
  53.  
  54. %end if%
  55. const
  56.     %ConstItems%
  57.  
  58. %If MPW%
  59. {$S %unitname%}
  60.  
  61. %end if%
  62. %ItemProcs%
  63. {----------}
  64. Procedure Init%dlogname%;
  65. var
  66.     theDialog:        DialogPtr;
  67.     %dlogname%Data:        %dlogname%Handle;
  68. Begin
  69.     %dlogname%Dialog := GetNewDialog (%dlogname%ID, nil, pointer (-1));
  70.     theDialog := %dlogname%Dialog;
  71.     SetPort (theDialog);
  72.     %dlogname%Data := %dlogname%Handle (NewHandle (sizeof (%dlogname%Rec)));
  73.     SetWRefCon (theDialog, longint (%dlogname%Data));
  74.     HLock (Handle (%Dlogname%Data));
  75.     with %dlogname%Data^^ do begin
  76.         %InitFields%
  77.         %SetItems%
  78.         %EnableItems%
  79.     end; {with}
  80.     HUnlock (Handle (%Dlogname%Data));
  81. End; {Init%dlogname%}
  82.  
  83. {----------}
  84. Procedure Do%dlogname%;
  85. Begin
  86.     if %dlogname%Dialog <> nil then begin
  87.         SelectWindow (%dlogname%Dialog);
  88.         ShowWindow (%dlogname%Dialog);
  89.     end; {if}
  90. End; {Do%dlogname%}
  91.  
  92. {----------}
  93. Procedure Close%dlogname%;
  94. Begin
  95.     HideWindow (%dlogname%Dialog);
  96. End; {Close%dlogname%}
  97.  
  98. {----------}
  99. Function Filter%dlogname%    {(whichDialog:    DialogPtr;
  100.                       var event:        EventRecord;
  101.                       var itemHit:        integer): boolean};
  102. var
  103.     filtered:        boolean;
  104. Begin
  105.     filtered := false;
  106.     %FilterItems%
  107.     if not filtered then begin
  108.         filtered := StandardFilter (whichDialog, event, itemHit);
  109.     end;
  110.     Filter%dlogname% := filtered;
  111. End; {Filter%dlogname%}
  112.  
  113. {----------}
  114. Procedure Do%dlogname%Item {(itemNr:    integer)};
  115. Var
  116.     theDialog:        DialogPtr;
  117.     %dlogname%Data:        %dlogname%Handle;
  118. Begin
  119.     theDialog := %dlogname%Dialog;
  120.     SetPort (theDialog);
  121.     %dlogname%Data := %dlogname%Handle (GetWRefCon (theDialog));
  122.     HLock (Handle (%Dlogname%Data));
  123.     with %dlogname%Data^^ do begin
  124.         case itemNr of
  125.             %HandleItems%
  126.         end; {case}
  127.         %EnableItems%
  128.     end; {with}
  129.     HUnlock (Handle (%Dlogname%Data));
  130. End; {Do%dlogname%Item}
  131.  
  132. End. {%unitname%}
  133.  
  134.